#!/bin/bash

set -e
set -x


if [ ! -n "$1"  ];then
   echo "image  is null"
   exit -1
fi

docker_image=$1
if [[ "x" == "x$(echo $docker_image | grep '/')" ]]; then
    harbor_image="harbor.corp.hongen.com/library/$docker_image"
else
    harbor_image="harbor.corp.hongen.com/$docker_image"
fi

docker pull "$docker_image"
docker tag "$docker_image" "$harbor_image"
docker push "$harbor_image"